package com.yidu.logisticssystem.service.impl;

import com.yidu.logisticssystem.entity.LogisticsReceipt;
import com.yidu.logisticssystem.dao.LogisticsReceiptDao;
import com.yidu.logisticssystem.service.LogisticsReceiptService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (LogisticsReceipt)表服务实现类
 *
 * @author makejava
 * @since 2021-03-09 14:36:05
 */
@Service("logisticsReceiptService")
public class LogisticsReceiptServiceImpl implements LogisticsReceiptService {
    @Resource
    private LogisticsReceiptDao logisticsReceiptDao;

    /**
     * 通过ID查询单条数据
     *
     * @param receiptWaynum 主键
     * @return 实例对象
     */
    @Override
    public LogisticsReceipt queryById(String receiptWaynum) {

        return this.logisticsReceiptDao.queryById(receiptWaynum);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<LogisticsReceipt> queryAllByLimit(int offset, int limit) {
        return this.logisticsReceiptDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param logisticsReceipt 实例对象
     * @return 实例对象
     */
    @Override
    public LogisticsReceipt insert(LogisticsReceipt logisticsReceipt) {
        this.logisticsReceiptDao.insert(logisticsReceipt);
        return logisticsReceipt;
    }

    /**
     * 修改数据
     *
     * @param logisticsReceipt 实例对象
     * @return 实例对象
     */
    @Override
    public LogisticsReceipt update(LogisticsReceipt logisticsReceipt) {
        this.logisticsReceiptDao.update(logisticsReceipt);
        return null;
    }

    /**
     * 通过主键删除数据
     *
     * @param receiptId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer receiptId) {
        return this.logisticsReceiptDao.deleteById(receiptId) > 0;
    }
}
